//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package com.yang.newcustomcuilian.listeners;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.locks.ReentrantLock;
import com.yang.newcustomcuilian.particleseffect.CheckThread;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.entity.LivingEntity;
import org.bukkit.scheduler.BukkitRunnable;

public class SuitEffectListener extends BukkitRunnable {
    public static Boolean canUseParticlesEffect = true;
    public static ReentrantLock lock = new ReentrantLock();

    public SuitEffectListener() {
    }

    public static List<LivingEntity> getEntities() {
        List<LivingEntity> players = new ArrayList();
        Iterator var1 = Bukkit.getWorlds().iterator();

        while(var1.hasNext()) {
            World w = (World)var1.next();
            Iterator var3 = w.getLivingEntities().iterator();

            while(var3.hasNext()) {
                LivingEntity e = (LivingEntity)var3.next();
                players.add(e);
            }
        }

        return players;
    }

    public void run() {
        ExecutorService executorService = Executors.newFixedThreadPool(10);
        Iterator var2 = getEntities().iterator();

        while(var2.hasNext()) {
            LivingEntity p = (LivingEntity)var2.next();
            executorService.submit(new CheckThread(p));
        }

        executorService.shutdown();
    }

    public static int getPet(String s) {
        if (s.equalsIgnoreCase("SPEED")) {
            return 1;
        } else if (s.equalsIgnoreCase("SLOW")) {
            return 2;
        } else if (s.equalsIgnoreCase("FAST_DIGGING")) {
            return 3;
        } else if (s.equalsIgnoreCase("SLOW_DIGGING")) {
            return 4;
        } else if (s.equalsIgnoreCase("INCREASE_DAMAGE")) {
            return 5;
        } else if (s.equalsIgnoreCase("HEAL")) {
            return 6;
        } else if (s.equalsIgnoreCase("HARM")) {
            return 7;
        } else if (s.equalsIgnoreCase("JUMP")) {
            return 8;
        } else if (s.equalsIgnoreCase("CONFUSION")) {
            return 9;
        } else if (s.equalsIgnoreCase("REGENERATION")) {
            return 10;
        } else if (s.equalsIgnoreCase("DAMAGE_RESISTANCE")) {
            return 11;
        } else if (s.equalsIgnoreCase("FIRE_RESISTANCE")) {
            return 12;
        } else if (s.equalsIgnoreCase("WATER_BREATHING")) {
            return 13;
        } else if (s.equalsIgnoreCase("INVISIBILITY")) {
            return 14;
        } else if (s.equalsIgnoreCase("BLINDNESS")) {
            return 15;
        } else if (s.equalsIgnoreCase("NIGHT_VISION")) {
            return 16;
        } else if (s.equalsIgnoreCase("HUNGER")) {
            return 17;
        } else if (s.equalsIgnoreCase("WEAKNESS")) {
            return 18;
        } else if (s.equalsIgnoreCase("POISON")) {
            return 19;
        } else if (s.equalsIgnoreCase("WITHER")) {
            return 20;
        } else if (s.equalsIgnoreCase("HEALTH_BOOST")) {
            return 21;
        } else if (s.equalsIgnoreCase("ABSORPTION")) {
            return 22;
        } else {
            return s.equalsIgnoreCase("SATURATION") ? 23 : 0;
        }
    }
}
